package com.cennavi.buss.service.imp;

import com.cennavi.buss.service.SearchService;
import com.cennavi.minemap.bean.MessageBean;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@FeignClient(value = "lbs-service", fallback = SearchService.class)
public interface ISearchService {
    @RequestMapping(method = RequestMethod.GET, value = "/service/search/keyword")
    MessageBean keyword(@RequestParam("token") String token,
                        @RequestParam(value = "adCode", defaultValue = "") String adCode, @RequestParam("key") String key,
                        @RequestParam(value = "searchType", defaultValue = "all") String searchType,
                        @RequestParam(value = "dataType", defaultValue = "") String dataType,
                        @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
                        @RequestParam(value = "pageCount", defaultValue = "10") Integer pageCount,
                        @RequestParam(value = "source", defaultValue = "1") Integer source);

    @RequestMapping(method = RequestMethod.GET, value = "/service/search/surround")
    MessageBean surround(@RequestParam("token") String token,
                         @RequestParam(value = "adCode", defaultValue = "") String adCode, @RequestParam("key") String key,
                         @RequestParam(value = "searchType", defaultValue = "all") String searchType,
                         @RequestParam(value = "dataType", defaultValue = "") String dataType,
                         @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
                         @RequestParam(value = "pageCount", defaultValue = "10") Integer pageCount,
                         @RequestParam(value = "source", defaultValue = "1") Integer source,
                         @RequestParam(value = "location") String location,
                         @RequestParam(value = "inRadius", defaultValue = "0") Integer inRadius,
                         @RequestParam(value = "spatialFunction", defaultValue = "geofilt") String spatialFunction,
                         @RequestParam(value = "radius", defaultValue = "500") Integer radius,
                         @RequestParam(value = "seq", defaultValue = "0") Integer seq);

    @RequestMapping(method = RequestMethod.GET, value = "/service/search/bbox")
    MessageBean bbox(@RequestParam("token") String token,
                     @RequestParam(value = "adCode", defaultValue = "") String adCode, @RequestParam("key") String key,
                     @RequestParam("bounds") String bounds,
                     @RequestParam(value = "searchType", defaultValue = "all") String searchType,
                     @RequestParam(value = "dataType", defaultValue = "") String dataType,
                     @RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
                     @RequestParam(value = "pageCount", defaultValue = "10") Integer pageCount,
                     @RequestParam(value = "source", defaultValue = "1") Integer source,
                     @RequestParam(value = "seq", defaultValue = "0") Integer seq);

    @RequestMapping(method = RequestMethod.GET, value = "/service/route/driving")
    MessageBean driving(@RequestParam("token") String token, @RequestParam("sPoint") String sPoint,
                        @RequestParam("ePoint") String ePoint,
                        @RequestParam(value = "wayPoints", defaultValue = "") String wayPoints,
                        @RequestParam(value = "shpFlag", defaultValue = "1") Integer shpFlag,
                        @RequestParam(value = "costModel", defaultValue = "16") Integer costModel,
                        @RequestParam(value = "vehicleSpeed", defaultValue = "0") Integer vehicleSpeed,
                        @RequestParam(value = "numAlt", defaultValue = "1") Integer numAlt,
                        @RequestParam(value = "criteria", defaultValue = "0") Integer criteria,
                        @RequestParam(value = "source", defaultValue = "1") String source,
                        @RequestParam(value = "traffic", defaultValue = "0") Integer traffic);

    /**
     * 路线规划
     * <p>
     * 新接口{@link ISearchService#newDriving2(java.lang.String, java.lang.String, java.lang.Integer, java.lang.String, java.lang.String)}
     */
    @RequestMapping(method = RequestMethod.GET, value = "/service/route/driving2")
    @ResponseBody
    MessageBean newDriving(@RequestParam("token") String token,
                           @RequestParam(value = "source", defaultValue = "1") String source,
                           @RequestParam("sPoint") String sPoint,
                           @RequestParam("ePoint") String ePoint,
                           @RequestParam(value = "wayPoints", defaultValue = "") String wayPoints,
                           @RequestParam(value = "st", defaultValue = "4") Integer st,
                           @RequestParam(value = "avoidArea", defaultValue = "") String avoidArea);

    /**
     * 公交换乘-经纬度查询
     * <p>
     * 新接口{@link ISearchService#busTransfer2(java.lang.String, java.lang.String, java.lang.String, java.lang.Integer)}
     */
    @Deprecated
    @RequestMapping(method = RequestMethod.GET, value = "/service/route/busTransfer")
    MessageBean busTransfer(@RequestParam("token") String token, @RequestParam("adCode") String adCode,
                            @RequestParam(value = "strategy", defaultValue = "0") Integer strategy,
                            @RequestParam(value = "shpInfoFlag", defaultValue = "1") Integer shpInfoFlag,
                            @RequestParam("sPoint") String sPoint, @RequestParam("ePoint") String ePoint,
                            @RequestParam(value = "showWalkInfo", defaultValue = "0") Integer showWalkInfo,
                            @RequestParam(value = "source", defaultValue = "1") Integer source);

    /**
     * 公交线路关键字查询
     * <p>
     * 新接口{@link ISearchService#busRoute2(java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Integer, java.lang.Integer)}
     */
    @Deprecated
    @RequestMapping(method = RequestMethod.GET, value = "/service/route/busRoute")
    MessageBean busRoute(@RequestParam("adCode") String adCode, @RequestParam(value = "keyword") String keyword);

    /**
     * 公交站点关键字查询
     * <p>
     * 新接口{@link ISearchService#busStation2(java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer)}
     */
    @Deprecated
    @RequestMapping(method = RequestMethod.GET, value = "/service/route/busStation")
    MessageBean busStation(@RequestParam("adCode") String adCode,
                           @RequestParam(value = "keyword") String keyword);

    @RequestMapping(method = RequestMethod.GET, value = "/service/search/adminByPoint")
    MessageBean adminByPoint(@RequestParam("token") String token, @RequestParam("location") String location,
                             @RequestParam(value = "geometry", defaultValue = "0") Integer geometry,
                             @RequestParam(value = "source", defaultValue = "1") Integer source,
                             @RequestParam(value = "language", defaultValue = "0") Integer language);

    /**
     * 地理编码 POI 查询
     * <p>
     * 新接口{@link ISearchService#geocoding2(java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer)}
     */
    @Deprecated
    @RequestMapping(method = RequestMethod.GET, value = "/service/coder/geocoding")
    MessageBean geocoding(@RequestParam("token") String token, @RequestParam("address") String address,
                          @RequestParam("adCode") String adCode, @RequestParam(value = "source", defaultValue = "1") Integer source);

    /**
     * 地理编码评分
     * <p>
     * 新接口对应如下:
     *
     * @see ISearchService#geocodingScore2(java.lang.String, java.lang.String)
     */
    @Deprecated
    @RequestMapping(method = RequestMethod.GET, value = "/service/coder/geocoding/score")
    MessageBean geocodingScore(@RequestParam("token") String token,
                               @RequestParam("address") String address,
                               @RequestParam("adCode") String adCode);

    /**
     * 逆地理编码查询
     * <p>
     * 新接口{@link ISearchService#reverseGeocoding2(java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Integer)}
     */
    @Deprecated
    @RequestMapping(method = RequestMethod.GET, value = "/service/coder/reverseGeocoding")
    MessageBean reverseGeocoding(@RequestParam("token") String token, @RequestParam("location") String location,
                                 @RequestParam(value = "type", defaultValue = "1") Integer type,
                                 @RequestParam(value = "radius", defaultValue = "300") Integer radius,
                                 @RequestParam(value = "roadRadius", defaultValue = "300") Integer roadRadius,
                                 @RequestParam(value = "kind", defaultValue = "0") Integer kind,
                                 @RequestParam(value = "source", defaultValue = "1") Integer source);

    @RequestMapping(method = RequestMethod.GET, value = "/service/search/around")
    MessageBean around(@RequestParam("token") String token, @RequestParam("location") String location,
                       @RequestParam("type") String type, @RequestParam(value = "radius", defaultValue = "1000") Integer radius,
                       @RequestParam(value = "count", defaultValue = "5") Integer count);

    @RequestMapping(method = RequestMethod.GET, value = "/service/tips/smartTips")
    MessageBean smartTips(@RequestParam("token") String token, @RequestParam("input") String input,
                          @RequestParam("adCode") int adCode,
                          @RequestParam(value = "searchType", defaultValue = "all") String searchType,
                          @RequestParam(value = "pageCount", defaultValue = "10") Integer pageCount);

    @RequestMapping(method = RequestMethod.GET, value = "/service/search/suggest")
    MessageBean suggest(@RequestParam("keywords") String keywords, @RequestParam("city") String city);

    /* --------------------------------------------- minemap 接口调整 ------------------------------------------------ */

    /**
     * 地理编码评分(新)
     * <p>
     * 原接口{@link ISearchService#geocodingScore(java.lang.String, java.lang.String, java.lang.String)}
     */
    @RequestMapping(value = "/service/coder/geocoding/score2")
    MessageBean geocodingScore2(@RequestParam("keywords") String keywords,
                                @RequestParam("city") String city);

    /**
     * 路线规划(新)
     * <p>
     * 原接口{@link ISearchService#newDriving(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.String)}
     */
    @RequestMapping("/service/route/driving3")
    MessageBean newDriving2(@RequestParam("sPoint") String sPoint,
                            @RequestParam("ePoint") String ePoint,
                            @RequestParam(value = "st", defaultValue = "4") Integer st,
                            @RequestParam(value = "wayPoints", defaultValue = "") String wayPoints,
                            @RequestParam(value = "avoidArea", defaultValue = "") String avoidArea);

    /**
     * 货车路线规划
     */
    @RequestMapping("/route/truck-driving")
    MessageBean truckDriving(@RequestParam("sPoint") String sPoint,
                             @RequestParam("ePoint") String ePoint,
                             @RequestParam(value = "st", defaultValue = "4", required = false) Integer st,
                             @RequestParam(value = "wayPoints", defaultValue = "", required = false) String wayPoints,
                             @RequestParam(value = "avoidArea", defaultValue = "", required = false) String avoidArea,
                             @RequestParam(value = "length", required = false) Double length,
                             @RequestParam(value = "height", required = false) Double height,
                             @RequestParam(value = "width", required = false) Double width,
                             @RequestParam(value = "weight", required = false) Integer weight,
                             @RequestParam(value = "axleWeight", required = false) Integer axleWeight,
                             @RequestParam(value = "axleCount", required = false) Integer axleCount,
                             @RequestParam(value = "hasPassport", required = false) Boolean hasPassport,
                             @RequestParam(value = "energyType", required = false) Integer energyType,
                             @RequestParam(value = "emissionStandard", required = false) Integer emissionStandard,
                             @RequestParam(value = "truckLoadType", required = false) Integer truckLoadType,
                             @RequestParam(value = "truckType", required = false) Integer truckType,
                             @RequestParam(value = "truckFunction", required = false) Integer truckFunction,
                             @RequestParam(value = "plateNumber", required = false) Integer plateNumber);

    /**
     * 公交换乘-经纬度查询(新)
     * <p>
     * 原接口{@link ISearchService#busTransfer(java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer)}
     */
    @RequestMapping("/service/route/bus-transfer")
    MessageBean busTransfer2(@RequestParam(value = "city", defaultValue = "") String city,
                             @RequestParam("sPoint") String sPoint,
                             @RequestParam("ePoint") String ePoint,
                             @RequestParam(value = "strategy", defaultValue = "0") Integer strategy);

    /**
     * 公交站点关键字查询
     * <p>
     * 原接口{@link ISearchService#busStation(java.lang.String, java.lang.String)}
     */
    @RequestMapping("/service/route/bus-station")
    MessageBean busStation2(@RequestParam(value = "keyword") String keyword,
                            @RequestParam("city") String city,
                            @RequestParam(name = "pn", defaultValue = "1") Integer pn,
                            @RequestParam(name = "rn", defaultValue = "20") Integer rn);

    /**
     * 公交线路关键字查询
     * <p>
     * 原接口{@link ISearchService#busRoute(java.lang.String, java.lang.String)}
     */
    @RequestMapping("/service/route/bus-route")
    MessageBean busRoute2(@RequestParam("city") String city,
                          @RequestParam("keyword") String keyword,
                          @RequestParam(name = "type", defaultValue = "name") String type,
                          @RequestParam(name = "opposite", defaultValue = "false") Boolean opposite,
                          @RequestParam(name = "pn", defaultValue = "1") Integer pn,
                          @RequestParam(name = "rn", defaultValue = "20") Integer rn);

    /**
     * 地理编码 POI 查询(新)
     * <p>
     * 原接口{@link ISearchService#geocoding(java.lang.String, java.lang.String, java.lang.String, java.lang.Integer)}
     */
    @RequestMapping("/coder/geocoding2")
    MessageBean geocoding2(@RequestParam("keywords") String keywords,
                           @RequestParam("city") String city,
                           @RequestParam(value = "page_num", defaultValue = "1") Integer page_num,
                           @RequestParam(value = "page_size", defaultValue = "10") Integer page_size);

    /**
     * 逆地理编码查询(新)
     * <p>
     * 原接口{@link ISearchService#reverseGeocoding(java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer)}
     */
    @RequestMapping(value = "/coder/reverse-geocoding")
    MessageBean reverseGeocoding2(@RequestParam("location") String location,
                                  @RequestParam(value = "detail", defaultValue = "0") Integer detail,
                                  @RequestParam(value = "road", defaultValue = "0") Integer road,
                                  @RequestParam(value = "rowNumber", defaultValue = "0") Integer rowNumber);

    /**
     * 一框搜索(新)
     */
    @RequestMapping("/search/keyword2")
    MessageBean keywordSearch(@RequestParam(value = "city", defaultValue = "") String city,
                              @RequestParam("keywords") String keywords,
                              @RequestParam("location") String location,
                              @RequestParam(value = "area", required = false) String area,
                              @RequestParam(value = "range", defaultValue = "3000") String range,
                              @RequestParam(value = "zoom", defaultValue = "12") Integer zoom,
                              @RequestParam(value = "search_type", defaultValue = "normal") String searchType,
                              @RequestParam(value = "language", defaultValue = "zh_CN") String language,
                              @RequestParam(value = "page_num", defaultValue = "1") Integer pageNum,
                              @RequestParam(value = "page_size", defaultValue = "10") Integer pageSize);

    /**
     * 行政区信息查询
     *
     * @param keywords
     * @param location
     * @return
     */
    @RequestMapping("/search/admin")
    MessageBean adminSearch(@RequestParam("keywords") String keywords,
                            @RequestParam(name = "location", defaultValue = "") String location);
}
